<!DOCTYPE html>
<html>
<head>
<title>Signin</title>
<link href="__CSS__/style.css" rel='stylesheet' type='text/css' />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="App Sign in Form,Login Forms,Sign up Forms,Registration Forms,News latter Forms,Elements"./>
</script>

</head>
<body>
    <h1>Exam System</h1>
        <div class="app-cam">
            <div class="cam"><img src="__IMG__/cam.png" class="img-responsive" alt="" /></div>
            <div>
                <input type="text" class="text" name="uname" id="uname" placeholder="用户名" >
                <input type="password" name="pwd" id="pwd" placeholder="密码">
                <input type="password" name="repwd" id="repwd" placeholder="重复密码">
                <div class="submit"><input type="submit" onclick="register();" value="注册" ></div>
                <div class="clear"></div>
                <div class="new">
                    <p class="sign"><a href="{:U('login',array('from'=>'index'))}"> 登录</a></p>
                    <div class="clear"></div>
                </div>
            </div>
        </div>
    <!--start-copyright-->
        <div class="copy-right">
                <p></p>
        </div>
    <!--//end-copyright-->
<script>
function register() {
    var uname = $("#uname").val();
    var pwd = $("#pwd").val();
    var repwd = $("#repwd").val();
    if (uname == '') {
        alert("用户名不能为空");
        return false;
    } else if (pwd != repwd) {
        alert("两次密码输入不一致");
        return false;
    }
    $.post("{:U('registerCkeck')}",{uname:uname,pwd:pwd},function(msg){
        if (msg.status == 1) {
            location.href = "{:U('/Home/index')}";
        } else {
            alert(msg.error);
        }
    });
}
</script>
<script src="__STATIC__/jquery-1.9.1.min.js"></script>
</body>
</html>